
module libeventd.event.Struct ;

import
	libeventd.Types ;

enum {
	EVLIST_TIMEOUT	=	0x01 ,
	EVLIST_INSERTED=	0x02 ,
	EVLIST_SIGNAL	=	0x04 ,
	EVLIST_ACTIVE	=	0x08 ,
	EVLIST_INTERNAL=	0x10 ,
	EVLIST_INIT	=	0x80 ,
	EVLIST_ALL	=	0xf000 | 0x9f  ,
}

private {
	struct ev_io_t {
		TAILQ_ENTRY!(event)	ev_io_next;
		timeval		ev_timeout;
	}

	struct ev_signal_t {
		TAILQ_ENTRY!(event)	ev_signal_next;
		ev_short	ev_ncalls;
		ev_short*	ev_pncalls;
	}
}
struct event {
	TAILQ_ENTRY!(event)	ev_active_next;
	TAILQ_ENTRY!(event)	ev_next;
	union {
		TAILQ_ENTRY!(event)	ev_next_with_common_timeout;
		int	min_heap_idx;
	} // ev_timeout_pos;
	evutil_socket_t	ev_fd;
	event_base*	ev_base;
	union {
		ev_io_t	ev_io ;
		ev_signal_t ev_signal;
	} //_ev;
	ev_short	ev_events;
	ev_short	ev_res;		/* result passed to event callback */
	ev_short	ev_flags;
	ev_uint8_t	ev_pri;	/* smaller numbers are higher priority */
	ev_uint8_t	ev_closure;
	timeval	ev_timeout;

	/* allows us to adopt for different types of events */
	void function(evutil_socket_t, ev_short, void*)	ev_callback;
	void *ev_arg;
}

struct evkeyval {
	TAILQ_ENTRY!(evkeyval)	next;
	char*	key;
	char*	value;
}


struct event_list{
	mixin TAILQ_HEAD!(event) ;
}

struct evkeyvalq {
	mixin TAILQ_HEAD!(evkeyval) ;
}

